# 

name = input()
password = input()
sname = input()
spassword = input()
if(name == sname and password == spassword):
	print("login successfully")
elif(name == sname and password != spassword):
	print("wrong password")
else:
	print("invalid account")